package com.talkology.pilot.student.controller;

import com.talkology.pilot.database.model.PayCount;
import com.talkology.pilot.student.service.IPayCountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping(value = "/payCount")
public class PayCountController {
    @Autowired
    private IPayCountService service;


    @RequestMapping(value = "/all", method= RequestMethod.GET)
    @ResponseBody
    public List<PayCount> getTeacherByFilter(@RequestParam(value = "number", required = false)String number,
                                             @RequestParam(value = "consumer", required = false)String consumer,
                                             @RequestParam(value = "status", required = false)Integer status,
                                             @RequestParam(value = "startTime", required = false)String startTime,
                                             @RequestParam(value = "endTime", required = false)String endTime,
                                             @RequestParam(value = "minAmount", required = false)Integer minAmount) {
        return service.getAllByFilter(number, consumer, status, startTime, endTime, minAmount);
    }

    @RequestMapping(value = "/info", method= RequestMethod.GET)
    @ResponseBody
    public PayCount getInfo(@RequestParam(value = "index", required = true) Long index) {
        return service.getInfo(index);
    }
}
